(function ($) {
	$(function () {;
		$('#upload-form').submit(function() {
		if($("input[id$='Title']").val() == ''){
			alert("Please Fill The Title");
			$("input[id$='Title']").focus();
			return false;
		}else if($("#Content").val() == ''){
			alert("Please Fill The Content");
			$("#Content").focus();
			return false;
		
		}
		var clientWidth = Math.max(document.documentElement.clientWidth,document.body.clientWidth),clientHeight = Math.max(document.documentElement.clientHeight,document.body.clientHeight);
		$("body").append($('<div class="iframe-mask" style="position:absolute;left:0;top:0;z-index:99;background-color:#fff;opacity:0.3;filter:alpha(opacity=30);width:' + clientWidth + 'px; height:' + clientHeight + 'px"></div>'));
		$("body").find(".iframe-mask").append("<img src='html/style/img/wait.gif'/><iframe src='' scrolling='no' frameborder='0' style = 'width:" + clientWidth + "px;height:" + clientHeight + "px;position:absolute;top:0;left:0;z-index:99;opacity:0;filter:alpha(opacity=0);'></iframe>");
		$(".iframe-mask img").css({'top':clientHeight/2,'left':clientWidth/2,'position':'absolute','z-index':100});

				
		$('#upload-frame').load(function () {
		$(".iframe-mask").fadeOut(200,function(){
		$(".iframe-mask").remove();
		});
		location.href="index.php?action="+$("#model").val()+"&category="+$("#category").val();
		});

	});});
}(jQuery));